/*
package com.flowabledemo.controller;

import com.flowabledemo.dto.TaskRepresentation;
import com.flowabledemo.service.MyService;
import io.swagger.annotations.Api;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.SequenceFlow;
import org.flowable.engine.repository.Deployment;
import org.flowable.task.api.Task;
import org.flowable.validation.ProcessValidator;
import org.flowable.validation.ProcessValidatorFactory;
import org.flowable.validation.ValidationError;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping(value = "cus")
@Api(value = "CustomizedFlowController", tags = {"定制化流程 信息接口"})
public class CustomizedFlowController {

    @Autowired
    private MyService myService;



    @RequestMapping(value="/create", method= RequestMethod.POST)
    public void create() {
            Deployment deploy=null;
            try {

                BpmnModel bpmnModel=new BpmnModel();
                //设置流程信息
                //此信息都可以通过前期自定义数据,使用时再查询
                Process process=new Process();
                process.setId("test_model_3");
                process.setName("测试流程图三");
                //添加流程节点信息---start
                String startId="startEvent_id_1";
                String startName="开始_1";
                String endId="endEvent_id_1";
                String endName="结束_1";
                //创建数组存储所有流程节点信息
                List<FlowElement> elementList=new ArrayList<>();
                //创建开始节点
                FlowElement startFlowElement=createStartFlowElement(startId,startName);
                FlowElement endFlowElement=createEndFlowElement(endId,endName);
                elementList.add(startFlowElement);
                elementList.add(endFlowElement);

                //查询普通任务节点信息
                elementList.addAll(findUserTaskElements());

                //把节点放入process
                elementList.stream().forEach(item -> process.addFlowElement(item));

                //查询各个节点的关系信息,并添加进流程
                List<FlowElementPojo> flowElementPojoList =createCirculationSequence();
                for (FlowElementPojo flowElementPojo:flowElementPojoList){
                    SequenceFlow sequenceFlow=createSequeneFlow(flowElementPojo.getId(),"流转",flowElementPojo.getResourceFlowElementId(),
                            flowElementPojo.getTargetFlowElementId(),"${a==\"f\"}");
                    process.addFlowElement(sequenceFlow);
                }

                bpmnModel.addProcess(process);

                //校验bpmModel
                ProcessValidator processValidator=new ProcessValidatorFactory().createDefaultProcessValidator();
                List<ValidationError> validationErrorList=processValidator.validate(bpmnModel);
                if (validationErrorList.size()>0){
                    throw new RuntimeException("流程有误，请检查后重试");
                }

                String fileName="model_"+activity+"bpmn20.xml";

                //生成自动布局
                new BpmnAutoLayout(bpmnModel).execute();
                deploy =repositoryService.createDeployment().addBpmnModel(fileName,bpmnModel)
                        .tenantId("intelligentAsset")
                        .deploy();
            }catch (Exception e){


            }finally {

            }

    }
    @RequestMapping(value="/process", method= RequestMethod.POST)
    public void startProcessInstance() {
        myService.startProcess();
    }

    @RequestMapping(value="/tasks", method= RequestMethod.GET, produces= MediaType.APPLICATION_JSON_VALUE)
    public List<TaskRepresentation> getTasks(@RequestParam String assignee) {
        List<Task> tasks = myService.getTasks(assignee);
        List<TaskRepresentation> dtos = new ArrayList<TaskRepresentation>();
        for (Task task : tasks) {
            dtos.add(new TaskRepresentation(task.getId(), task.getName()));
        }
        return dtos;
    }
}
*/
